import request from '@/config/axios'

export interface ChildVO {
  id: number
  avatar: string | undefined
  birthday: number | undefined
  createTime: number | undefined
  loginDate: number | undefined
  loginIp: string
  mark: string
  mobile: string
  name: string | undefined
  nickname: string | undefined
  registerIp: string
  sex: number
  status: number
  areaId: number | undefined
  areaName: string | undefined
  levelName: string | null
  point: number | undefined | null
  totalPoint: number | undefined | null
  experience: number | null | undefined
}

// 查询小孩列表
export const getChildPage = async (data) => {
  return await request.post({ url: `/member/child/getList`, data })
}

// 查询小孩详情
export const getChild = async (id: number) => {
  return await request.get({ url: `/member/child/detail/${id}` })
}

// 新增小孩
export const addChild = async (data: ChildVO) => {
  return await request.post({ url: `/member/child/addChild`, data })
}

// 修改小孩
export const updateChild = async (data: ChildVO) => {
  return await request.post({ url: `/member/child/updateChildInfo`, data })
}

// 删除小孩
export const deleteChild = async (data: any) => {
  return await request.delete({ url: `/member/child/deleteChildById/${id}` })
}

// 新增小孩身高
export const addHeightRecord = async (data: any) => {
  return await request.post({ url: `/member/child/addHeightRecord`, data })
}

// 获取小孩身高信息
export const getRecordList = async (data: any) => {
  return await request.post({ url: `/member/child/getRecordList`, data })
}
